//
//  DFHeadlineTableViewCell.m
//  DFMessage
//
//  Created by lanou on 15/10/23.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "DFHeadlineTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "DFSignlTon.h"
#import "DFHeadheadLineModel.h"

@implementation DFHeadlineTableViewCell

- (void)awakeFromNib {

  
    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        _leftImage = [[UIImageView alloc]init];
        CGFloat lx = (kScreenWidth)/4;
        _leftImage.frame = CGRectMake(5, 6, lx ,lx*3/4);
        _leftImage.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"holder.jpg"]];
        [self.contentView addSubview:_leftImage];
        
        _contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(lx + 10, 6, kScreenWidth * 3 / 4 - 20,40)];
        _contentLabel.font = [UIFont systemFontOfSize:15];
        _contentLabel.numberOfLines = 0;
        [self.contentView addSubview:_contentLabel];
        
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.frame = CGRectMake(lx + 10, lx *3 / 4 - 15,50, 15);
        _timeLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:_timeLabel];
        
        _reviewerLabel = [[UILabel alloc]init];
        _reviewerLabel.frame = CGRectMake(kScreenWidth - 43, lx *3 / 4 - 10, 40 , 15);
        _reviewerLabel.font = [UIFont systemFontOfSize:11];
        [self.contentView addSubview:_reviewerLabel];
        
        UIImageView *aimage = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - 60, lx *3 / 4 - 11, 15, 15)];
        aimage.image = [UIImage imageNamed:@"hot"];
        [self.contentView addSubview:aimage];
        
//        UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0, 73, kScreenWidth, 2)];
//        line.backgroundColor = [UIColor lightGrayColor];
//        [self.contentView addSubview:line];
}
    
    return self;
    
}



-(void)setConfigureModel:(DFHeadlineModel *)configureModel{
    _configureModel = configureModel;
    DFSignlTon *signlTon = [DFSignlTon shareInstance];
    if (signlTon.savemode == SaveModeYes)
    {
        _leftImage.image = [UIImage imageNamed:@""];
    }else
    {
        [_leftImage sd_setImageWithURL:[NSURL URLWithString:configureModel.imgsrc]];
    }
    
    _contentLabel.text = configureModel.stitle;
    
    _timeLabel.text = [[configureModel.sdate substringFromIndex:5] substringToIndex:5];
   
   _label.text = configureModel.label;
_reviewerLabel.text = [NSString stringWithFormat:@"%@",configureModel.comment_num];
    
    
    
}



@end
